home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / gg / ncurses-5.3.lha / ncurses-5.3 / include / MKparametrized.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2002-10-24  |  1KB  |  36 lines

  1. #!/bin/sh
  2. # $Id: MKparametrized.sh,v 1.5 2000/10/01 00:57:24 tom Exp $
  3. #
  4. # MKparametrized.sh -- generate indirection vectors for various sort methods
  5. #
  6. # The output of this script is C source for an array specifying whether
  7. # termcap strings should undergo parameter and padding translation.
  8. #
  9. CAPS="${1-Caps}"
  10. cat <<EOF
  11. /*
  12.  * parametrized.h --- is a termcap capability parametrized?
  13.  *
  14.  * Note: this file is generated using MKparametrized.sh, do not edit by hand.
  15.  * A value of -1 in the table means suppress both pad and % translations.
  16.  * A value of 0 in the table means do pad but not % translations.
  17.  * A value of 1 in the table means do both pad and % translations.
  18.  */
  19.  
  20. static short const parametrized[] = {
  21. EOF
  22.  
  23. # We detect whether % translations should be done by looking for #[0-9] in the
  24. # description field.  We presently suppress padding translation only for the
  25. # XENIX acs_* capabilities.  Maybe someday we'll dedicate a flag field for
  26. # this, that would be cleaner....
  27.  
  28. ${AWK-awk} <$CAPS '
  29. $3 != "str"    {next;}
  30. $1 ~ /^acs_/    {print "-1,\t/* ", $2, " */"; count++; next;}
  31. $0 ~ /#[0-9]/    {print "1,\t/* ", $2, " */"; count++; next;}
  32.         {print "0,\t/* ", $2, " */"; count++;}
  33. END        {printf("} /* %d entries */;\n\n", count);}
  34. '
  35.  
  36.